package com.hmdp.service.impl;

import com.hmdp.entity.Blog;
import com.hmdp.mapper.BlogMapper;
import com.hmdp.service.IBlogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hmdp.utils.MultiThreadQueryUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 虎哥
 * @since 2021-12-22
 */
@Service
public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements IBlogService {
    @Resource
    private BlogMapper blogMapper;

    @Autowired
    private MultiThreadQueryUtil multiThreadQueryUtil;
    //每个线程分页查询
    @Override
    public List<Blog> getQueryData(Integer start, Integer end) {
        return this.blogMapper.getQueryData(start,end);
    }
    //合并线程结果
    @Override
    public List getAllResult() {
        return multiThreadQueryUtil.getMultiCombineResult();
    }
}
